﻿		function addEventSimple(obj,evt,fn) {
			if (obj.addEventListener)
				obj.addEventListener(evt,fn,false);
			else if (obj.attachEvent)
				obj.attachEvent('on'+evt,fn);
		}
		
		addEventSimple(window,"load",initHandle);
		
		
		
		/**
		 * Event Handler 등록
		 * @return
		 */
		function initHandle() {
			/**
			 * 검색
			 */
			var handle_search = document.getElementById("handle_search");
			handle_search.onclick = function(){
				 if(document.all.startDate.value > document.all.endDate.value  ){
						alert("날짜 검색 범위를 올바르게 지정해 주세요.");
						return;
				 }
				var f = document.forms['tvAppBannerPopup'];
				f.action = "popupTvAppBanner.omp";
				f.submit();
			};
			/**
			 * 전체 검색
			 */
			var handle_search_all = document.getElementById("handle_search_all");
			handle_search_all.onclick = function(){
				var f = document.forms['tvAppBannerPopup'];
				f.action = "popupTvAppBanner.omp";
				f.pageSize.value = "";
				f.startDate.value = "";
				f.endDate.value = "";
				f.grade.value = "";
				f.genre.value = "";
				f.broadCaster.value = "";
				f.search_type.value = "";
				f.search_key.value = "";
				f.submit();
			};
			/**
			 * 검색 - Combo Box
			 */
			var handle_combo = document.getElementById("handle_combo");
			handle_combo.onchange = function(){
				var pageSize = this.options[this.selectedIndex].value;
				var f = document.forms['tvAppBannerPopup'];
				f.action = "popupTvAppBanner.omp";
				f.pageSize.value = pageSize;
				f.submit();
			};
			
			/**
			 * 페이징
			 */
			var paging = document.getElementsByTagName("a");
			for(var k=0;k<paging.length;k++){
				if(paging[k].getAttribute("id")=="paging"&&paging[k].getAttribute("handle")=="true"){
					paging[k].onclick = function(){
						var f = document.forms['tvAppBannerPopup'];
						f.action = "popupTvAppBanner.omp";
						f.pageNum.value = this.getAttribute("num");
						f.submit();
					};
				}
			}
			/**
			 * Button 제어
			 */
			
	
		}
		
		function fnSelected(id, nm, catNo, chlCd) {
			opener.parent.fnProdSetting(id, nm, catNo, chlCd);
			window.close();
		}
